package cn.edu.neusoft.neufooddemo.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import cn.edu.neusoft.neufooddemo.R;
import cn.edu.neusoft.neufooddemo.bean.CommentInfo;

import java.util.List;

/**
 * Created by Shinelon on 2017/3/31.
 */

public class FoodInfoAdapter extends RecyclerViewAdapter<FoodInfoAdapter.ViewHolder> {
    public FoodInfoAdapter(Context context, List data, int layoutResource) {
        super(context, data, layoutResource);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        CommentInfo entity = (CommentInfo) data.get(position);
        holder.foodinfo_comment_username.setText(entity.getUsername());
        holder.foodinfo_comment_time.setText(entity.getComment_time());
        holder.foodinfo_comment_content.setText(entity.getContent());


    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        TextView foodinfo_comment_username, foodinfo_comment_time, foodinfo_comment_content;

        public ViewHolder(View itemView) {
            super(itemView);
            foodinfo_comment_username = (TextView) itemView.findViewById(R.id.foodinfo_comment_username);
            foodinfo_comment_time = (TextView) itemView.findViewById(R.id.foodinfo_comment_time);
            foodinfo_comment_content = (TextView) itemView.findViewById(R.id.foodinfo_comment_content);
        }
    }
}